@layout("/common/_container.html",{title:"完善个人信息",js:["/assets/modular/recy/wechatUser/wechatUser.js","/assets/common/libs/rapid-validator/prototype_for_validation.js","/assets/common/libs/rapid-validator/validation_cn.js","/assets/common/libs/rapid-validator/tooltips.js"]}){
<style>
    .round_icon{
        width: 132px;
        height: 132px;
        display: flex;
        border-radius: 50%;
        align-items: center;
        justify-content: center;
        overflow: hidden;
    }
</style>
<div style="position:relative;">
    @if(!isEmpty(user.phone)){
    <div class="layui-form layui-form-pane" action="">
        <div class="layui-form-item" pane>
            <label class="layui-form-label">姓名</label>
            <div class="layui-input-block">
                <input type="text" name="" id="" class="layui-input" value="${user.wechatNickName}">
            </div>
        </div>
        <div class="layui-form-item" pane>
            <label class="layui-form-label">手机号</label>
            <div class="layui-input-block">
                <input type="text" name="" id="" class="layui-input" value="${user.phone}">
            </div>
        </div>
        <div class="layui-form-item" pane>
            <label class="layui-form-label">联系地址</label>
            <div class="layui-input-block">
                <input type="text" name="" id="" class="layui-input" value="${user.remark}">
            </div>
        </div>
    </div>
    @}else{
    <form action="#" class="layui-form">
        <input type="hidden" id="userId" name="userId" value="${user.id}">
        <div class='layui-form-item'>
            <div class="layui-inline">
                <label class="layui-form-label">姓名</label>
                <div class="layui-input-block">
                    <input style="width:150px" id="userName" name="userName" value="${user.wechatNickName!}" placeholder="请输入姓名" type="text" class="layui-input   " />
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">手机号</label>
                <div class="layui-input-block">
                    <input style="width:150px" id="phone" name="phone" placeholder="请输入手机号" type="text" class="layui-input   " />
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">联系地址</label>
                <div class="layui-input-block">
                    <input style="width:150px" id="remark" name="remark" placeholder="请输入联系地址" type="text" class="layui-input   " />
                </div>
            </div>
            <div class="layui-inline">
                <div class="layui-input-block">
                    <input type="button" class="layui-btn" id="completeUserBtn" value="提交">
                </div>
            </div>
        </div>
    </form>
    @}
</div>
@}
<script>
    layui.use(["form","jquery","ax"],function(){
        var $=layui.jquery;
        var form = layui.form;
        var $ax = layui.ax;
        $("#completeUserBtn").click(function(data){
            var userName = $("#userName").val();
            if($.trim(userName)==""){
                Feng.error("姓名不能为空！");
                return false;
            }
            var phone=$("#phone").val();
            if($.trim(phone)=="" || !/^\d{11}$/.test(phone)){
                Feng.error("手机号必须是11位数字");
                return false;
            }
            var address=$("#remark").val();
            if($.trim(address)==""){
                Feng.error("地址不能为空！");
                return false;
            }

            var ajax = new $ax(Feng.ctxPath + "/app/saveUserInfo", function (data) {
                Feng.success(data.message);
            }, function (data) {
                Feng.error("完善个人信息失败！" );
            });
            ajax.set("userId",$("#userId").val());
            ajax.set("userName",userName);
            ajax.set("phone",phone);
            ajax.set("remark",address);
            ajax.start();
            return false;
        });
    })
</script>